<template>
  <Layout desc="封装一个命令式弹窗">
    <el-button class="mt-60" @click="onClick" type="primary"
      >打开弹窗</el-button
    >
  </Layout>
</template>

<script setup lang="ts">
import LoginForm from './components/LoginForm.vue'
import { renderDialog } from '@/utils/renderDialog'

let closeFn: () => void
let instanceRef: Ref<typeof LoginForm>

const onClick = () => {
  let { close, instance } = renderDialog(
    LoginForm,
    {
      msg: '传给LoginForm的属性'
    },
    {
      foot: true,
      title: '用户登录',
      width: '500',
      'close-on-click-modal': false
    }
  )
  closeFn = close
  instanceRef = instance
}
</script>

<style scoped lang="scss"></style>
